package yang.service.impl;

import java.util.ArrayList;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import yang.dao.BaseDaoI;
import yang.dao.impl.OfficeDaoImpl;
import yang.model.HospitalOffice;
import yang.service.OfficeServiceI;
import yang.util.ComBox;
/**
 * 科室服务实现
 * @author 阳
 * @时间:2014年6月10日上午8:10:25
 *
 */
@Service("officeService")
public class OfficeServiceImpl implements OfficeServiceI {
	BaseDaoI<HospitalOffice> officeDao=new OfficeDaoImpl();
	/**
	 * 查询所有的科室
	 */
	@Override
	public List<ComBox> findAllOffice() {
		List<ComBox> boxs=new ArrayList<ComBox>();
		List<HospitalOffice> list=officeDao.find("from HospitalOffice");
		for (HospitalOffice hospitalOffice : list) {
			ComBox box=new ComBox();
			box.setValue(hospitalOffice.getOfId().toString());
			box.setText(hospitalOffice.getOfName());
			boxs.add(box);
		}
		return boxs;
	}
	//--- get set ------
	public BaseDaoI<HospitalOffice> getOfficeDao() {
		return officeDao;
	}
	@Autowired
	public void setOfficeDao(BaseDaoI<HospitalOffice> officeDao) {
		this.officeDao = officeDao;
	}
	
	

}
